package com.yyplatform.admin.platform.config.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.yyplatform.admin.platform.config.model.entity.SysDictItemEntity;

/**
 * Created on 2024-09-14
 */
public interface SysDictItemRepository extends JpaRepository<SysDictItemEntity, Long>,
        JpaSpecificationExecutor<SysDictItemEntity> {


    Page<SysDictItemEntity> findByDictId(Long dictId, PageRequest pageRequestOrderByIdDesc);

    @Query(value = "delete from sys_dict_item where dict_id= :dictId ", nativeQuery = true)
    @Modifying
    void deleteByDictId(@Param("dictId") Long id);
}
